3.712 \(\int \frac{A+B \tan (e+f x)}{(a+i a \tan (e+f x)) (c-i c \tan (e+f x))^2} \, dx\)

Optimal. Leaf size=113 \[ -\frac{A+i B}{8 a c^2 f (-\tan (e+f x)+i)}+\frac{B+i A}{8 a c^2 f (\tan (e+f x)+i)^2}+\frac{x (3 A+i B)}{8 a c^2}+\frac{A}{4 a c^2 f (\tan (e+f x)+i)} \]

[Out]

((3*A + I*B)*x)/(8*a*c^2) - (A + I*B)/(8*a*c^2*f*(I - Tan[e + f*x])) + (I*A + B)/(8*a*c^2*f*(I + Tan[e + f*x])
^2) + A/(4*a*c^2*f*(I + Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.189822, antiderivative size = 113, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.073, Rules used = {3588, 77, 203} \[ -\frac{A+i B}{8 a c^2 f (-\tan (e+f x)+i)}+\frac{B+i A}{8 a c^2 f (\tan (e+f x)+i)^2}+\frac{x (3 A+i B)}{8 a c^2}+\frac{A}{4 a c^2 f (\tan (e+f x)+i)} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2),x]

[Out]

((3*A + I*B)*x)/(8*a*c^2) - (A + I*B)/(8*a*c^2*f*(I - Tan[e + f*x])) + (I*A + B)/(8*a*c^2*f*(I + Tan[e + f*x])
^2) + A/(4*a*c^2*f*(I + Tan[e + f*x]))

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rule 77

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{A+B \tan (e+f x)}{(a+i a \tan (e+f x)) (c-i c \tan (e+f x))^2} \, dx &=\frac{(a c) \operatorname{Subst}\left (\int \frac{A+B x}{(a+i a x)^2 (c-i c x)^3} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (\frac{-A-i B}{8 a^2 c^3 (-i+x)^2}-\frac{i (A-i B)}{4 a^2 c^3 (i+x)^3}-\frac{A}{4 a^2 c^3 (i+x)^2}+\frac{3 A+i B}{8 a^2 c^3 \left (1+x^2\right )}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{A+i B}{8 a c^2 f (i-\tan (e+f x))}+\frac{i A+B}{8 a c^2 f (i+\tan (e+f x))^2}+\frac{A}{4 a c^2 f (i+\tan (e+f x))}+\frac{(3 A+i B) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{8 a c^2 f}\\ &=\frac{(3 A+i B) x}{8 a c^2}-\frac{A+i B}{8 a c^2 f (i-\tan (e+f x))}+\frac{i A+B}{8 a c^2 f (i+\tan (e+f x))^2}+\frac{A}{4 a c^2 f (i+\tan (e+f x))}\\ \end{align*}

Mathematica [A]  time = 2.23363, size = 166, normalized size = 1.47 \[ \frac{(\cos (2 (e+f x))+i \sin (2 (e+f x))) (A+B \tan (e+f x)) (2 (A (-3-6 i f x)+B (2 f x+i)) \cos (e+f x)+(A+3 i B) \cos (3 (e+f x))-\sin (e+f x) ((-2 B+6 i A) \cos (2 (e+f x))+12 A f x+9 i A+4 i B f x+B))}{32 a c^2 f (\tan (e+f x)-i) (A \cos (e+f x)+B \sin (e+f x))} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*Tan[e + f*x])/((a + I*a*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2),x]

[Out]

((2*(A*(-3 - (6*I)*f*x) + B*(I + 2*f*x))*Cos[e + f*x] + (A + (3*I)*B)*Cos[3*(e + f*x)] - ((9*I)*A + B + 12*A*f
*x + (4*I)*B*f*x + ((6*I)*A - 2*B)*Cos[2*(e + f*x)])*Sin[e + f*x])*(Cos[2*(e + f*x)] + I*Sin[2*(e + f*x)])*(A
+ B*Tan[e + f*x]))/(32*a*c^2*f*(A*Cos[e + f*x] + B*Sin[e + f*x])*(-I + Tan[e + f*x]))

________________________________________________________________________________________

Maple [B]  time = 0.07, size = 209, normalized size = 1.9 \begin{align*}{\frac{A}{8\,af{c}^{2} \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{{\frac{i}{8}}B}{af{c}^{2} \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{{\frac{3\,i}{16}}\ln \left ( \tan \left ( fx+e \right ) -i \right ) A}{af{c}^{2}}}+{\frac{\ln \left ( \tan \left ( fx+e \right ) -i \right ) B}{16\,af{c}^{2}}}+{\frac{A}{4\,af{c}^{2} \left ( \tan \left ( fx+e \right ) +i \right ) }}+{\frac{{\frac{3\,i}{16}}\ln \left ( \tan \left ( fx+e \right ) +i \right ) A}{af{c}^{2}}}-{\frac{\ln \left ( \tan \left ( fx+e \right ) +i \right ) B}{16\,af{c}^{2}}}+{\frac{{\frac{i}{8}}A}{af{c}^{2} \left ( \tan \left ( fx+e \right ) +i \right ) ^{2}}}+{\frac{B}{8\,af{c}^{2} \left ( \tan \left ( fx+e \right ) +i \right ) ^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x)

[Out]

1/8/f/a/c^2/(tan(f*x+e)-I)*A+1/8*I/f/a/c^2/(tan(f*x+e)-I)*B-3/16*I/f/a/c^2*ln(tan(f*x+e)-I)*A+1/16/f/a/c^2*ln(
tan(f*x+e)-I)*B+1/4*A/a/c^2/f/(tan(f*x+e)+I)+3/16*I/f/a/c^2*ln(tan(f*x+e)+I)*A-1/16/f/a/c^2*ln(tan(f*x+e)+I)*B
+1/8*I/f/a/c^2/(tan(f*x+e)+I)^2*A+1/8/f/a/c^2/(tan(f*x+e)+I)^2*B

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.72389, size = 217, normalized size = 1.92 \begin{align*} \frac{{\left (4 \,{\left (3 \, A + i \, B\right )} f x e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (-i \, A - B\right )} e^{\left (6 i \, f x + 6 i \, e\right )} +{\left (-6 i \, A - 2 \, B\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 i \, A - 2 \, B\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{32 \, a c^{2} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/32*(4*(3*A + I*B)*f*x*e^(2*I*f*x + 2*I*e) + (-I*A - B)*e^(6*I*f*x + 6*I*e) + (-6*I*A - 2*B)*e^(4*I*f*x + 4*I
*e) + 2*I*A - 2*B)*e^(-2*I*f*x - 2*I*e)/(a*c^2*f)

________________________________________________________________________________________

Sympy [A]  time = 1.63348, size = 286, normalized size = 2.53 \begin{align*} \begin{cases} \frac{\left (\left (512 i A a^{2} c^{4} f^{2} - 512 B a^{2} c^{4} f^{2}\right ) e^{- 2 i f x} + \left (- 1536 i A a^{2} c^{4} f^{2} e^{4 i e} - 512 B a^{2} c^{4} f^{2} e^{4 i e}\right ) e^{2 i f x} + \left (- 256 i A a^{2} c^{4} f^{2} e^{6 i e} - 256 B a^{2} c^{4} f^{2} e^{6 i e}\right ) e^{4 i f x}\right ) e^{- 2 i e}}{8192 a^{3} c^{6} f^{3}} & \text{for}\: 8192 a^{3} c^{6} f^{3} e^{2 i e} \neq 0 \\x \left (- \frac{3 A + i B}{8 a c^{2}} + \frac{\left (A e^{6 i e} + 3 A e^{4 i e} + 3 A e^{2 i e} + A - i B e^{6 i e} - i B e^{4 i e} + i B e^{2 i e} + i B\right ) e^{- 2 i e}}{8 a c^{2}}\right ) & \text{otherwise} \end{cases} + \frac{x \left (3 A + i B\right )}{8 a c^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e))**2,x)

[Out]

Piecewise((((512*I*A*a**2*c**4*f**2 - 512*B*a**2*c**4*f**2)*exp(-2*I*f*x) + (-1536*I*A*a**2*c**4*f**2*exp(4*I*
e) - 512*B*a**2*c**4*f**2*exp(4*I*e))*exp(2*I*f*x) + (-256*I*A*a**2*c**4*f**2*exp(6*I*e) - 256*B*a**2*c**4*f**
2*exp(6*I*e))*exp(4*I*f*x))*exp(-2*I*e)/(8192*a**3*c**6*f**3), Ne(8192*a**3*c**6*f**3*exp(2*I*e), 0)), (x*(-(3
*A + I*B)/(8*a*c**2) + (A*exp(6*I*e) + 3*A*exp(4*I*e) + 3*A*exp(2*I*e) + A - I*B*exp(6*I*e) - I*B*exp(4*I*e) +
 I*B*exp(2*I*e) + I*B)*exp(-2*I*e)/(8*a*c**2)), True)) + x*(3*A + I*B)/(8*a*c**2)

________________________________________________________________________________________

Giac [A]  time = 1.43216, size = 228, normalized size = 2.02 \begin{align*} \frac{\frac{2 \,{\left (3 i \, A - B\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a c^{2}} + \frac{2 \,{\left (-3 i \, A + B\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a c^{2}} - \frac{2 \,{\left (3 \, A \tan \left (f x + e\right ) + i \, B \tan \left (f x + e\right ) - 5 i \, A + 3 \, B\right )}}{a c^{2}{\left (i \, \tan \left (f x + e\right ) + 1\right )}} + \frac{-9 i \, A \tan \left (f x + e\right )^{2} + 3 \, B \tan \left (f x + e\right )^{2} + 26 \, A \tan \left (f x + e\right ) + 6 i \, B \tan \left (f x + e\right ) + 21 i \, A + B}{a c^{2}{\left (\tan \left (f x + e\right ) + i\right )}^{2}}}{32 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))/(a+I*a*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/32*(2*(3*I*A - B)*log(tan(f*x + e) + I)/(a*c^2) + 2*(-3*I*A + B)*log(tan(f*x + e) - I)/(a*c^2) - 2*(3*A*tan(
f*x + e) + I*B*tan(f*x + e) - 5*I*A + 3*B)/(a*c^2*(I*tan(f*x + e) + 1)) + (-9*I*A*tan(f*x + e)^2 + 3*B*tan(f*x
 + e)^2 + 26*A*tan(f*x + e) + 6*I*B*tan(f*x + e) + 21*I*A + B)/(a*c^2*(tan(f*x + e) + I)^2))/f